package com.mindskip.xzs.utility;

import com.mindskip.xzs.domain.ExamPaper;
import com.mindskip.xzs.service.ExamPaperService;
import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVM;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class Demo {
    public static void main(String[] args) {
        Runnable runnable = new Runnable() {
            public void run() {
                SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
                SimpleDateFormat sdf1 = new SimpleDateFormat("EEEE");
                Date date = new Date();
                String week = sdf1.format(date);
                //String week = "星期一";
                if ((week.equals("星期一")||week.equals("星期二")||week.equals("星期三")||week.equals("星期四")||week.equals("星期五"))&&sdf.format(new Date()).equals("16:09:15")){
                    System.out.println("今天星期："+week);
                }
                System.out.println("当前的系统时间为：" + sdf.format(new Date()));
            }
        };
        ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
        //public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit);
        //command--执行的任务,initialDelay--延迟开始,period--间隔时间,unit--时间单位
        service.scheduleAtFixedRate(runnable, 0, 1, TimeUnit.SECONDS);
    }
}